home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 6 / Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso / 016a / 4dgfc4.zip / GFC.BTM next >
Text File  |  1991-12-14  |  3KB  |  105 lines

  1. rem GFC - Group File Compare (4th release)
  2. rem by C. Scott Davis
  3. rem Serious Cybernetics
  4. rem Phoenix StarFighter BBS
  5. rem (404) 869-3410 [Fido 1:3616/20]
  6.  
  7. unset tlp >& nul
  8. unset tdp >& nul
  9. iff "%1" EQ "" then
  10.   echo Usage : GFC filespec [listfile] [/d]
  11.   quit
  12. endiff
  13. echo ``
  14. echo Checking for duplicate files in %_cwds%%1
  15. iff "%2" NE "" then
  16.   iff "%@upper[%2]" EQ "/D" then
  17.     set tdp=%2
  18.   else
  19.     set tlp=%@upper[%2]
  20.   endiff
  21. endiff
  22. iff "%3" NE "" then
  23.   iff "%@upper[%3]" EQ "/D" then
  24.     set tdp=%3
  25.   else
  26.     set tlp=%@upper[%3]
  27.   endiff
  28. endiff
  29. iff "%tlp" NE "" then
  30.   echo File list will be written to %tlp
  31. endiff
  32. iff "%tdp" NE "" then
  33.   echo Duplicate files will be deleted
  34. endiff
  35. pushd %temp >& nul
  36. set ttmp=%_cwds >& nul
  37. popd >& nul
  38. dir %1 /a-d-h-s /os /f > %ttmp%tdir >&> nul
  39. set tdc=0
  40. set tcz=%@lines[%ttmp%tdir] >& nul
  41. set tc1=0
  42. echo ``
  43. :loop1
  44.   set tc2=%@eval[%tc1+1]
  45.   set tf1=%@upper[%@line[%ttmp%tdir,%tc1]]
  46.   :loop2
  47.     set tf2=%@upper[%@line[%ttmp%tdir,%tc2]]
  48.     iff exist %tf1 .AND. "%tf1" NE "**EOF**" .AND. exist %tf2 .AND. "%tf2" NE "**EOF**" then
  49.       echos Comparing %@name[%tf1].%@ext[%tf1] and %@name[%tf2].%@ext[%tf2] ...
  50.       iff %@filesize[%tf1] EQ %@filesize[%tf2] then
  51.         fc /b %tf1 %tf2 > %ttmp%tlog >&> nul
  52.         unset tkb >& nul
  53.         iff "%@line[%ttmp%tlog,1]" EQ "FC: no differences encountered" then
  54.           iff "%tlp" NE "" then
  55.             echos %@name[%tf1].%@ext[%tf1] and %@name[%tf2].%@ext[%tf2] are the same >> %tlp >&> nul
  56.             iff "%tdp" EQ "/D" then
  57.               echo ` (deleted)`  >> %tlp >&> nul
  58.             else
  59.               echo ``  >> %tlp >&> nul
  60.             endiff
  61.           endiff
  62.           echos ` *** SAME ***`
  63.           iff "%tdp" EQ "/D" then
  64.             del %tf2 >& nul
  65.             echos ` (deleted)`
  66.           endiff
  67.           set tdc=%@eval[%tdc+1]
  68.         endiff
  69.       else
  70.         set tc2=%@eval[%tcz]
  71.       endiff
  72.       echo ``
  73.       unset tkb >& nul
  74.       inkey /w0 %%tkb >& nul
  75.       iff "%tkb" EQ "e" then
  76.         echo *** CANCEL ***
  77.         goto end
  78.       endiff
  79.     endiff
  80.     set tc2=%@eval[%tc2+1] >& nul
  81.   if %tc2 LE %tcz goto loop2
  82.   set tc1=%@eval[%tc1+1] >& nul
  83. if %tc1 LE %tcz goto loop1
  84. :end
  85.   echo ``
  86.   echos %tdc duplicate file(s) found
  87.   iff "%tdp" EQ "/D" then
  88.     echo ` and deleted`
  89.   else
  90.     echo ``
  91.   endiff
  92.   if "%tlp" NE "" echo File list written to %tlp
  93.   del %ttmp%tlog >& nul
  94.   del %tmp%tdir >& nul
  95.   unset tkb >& nul
  96.   unset tf1 >& nul
  97.   unset tf2 >& nul
  98.   unset tc2 >& nul
  99.   unset tc1 >& nul
  100.   unset tcz >& nul
  101.   unset tdc >& nul
  102.   unset ttmp >& nul
  103.   unset tdp >& nul
  104.   unset tlp >& nul
  105.